<template>
  <div class="body-item-li">
    <template-new :temp="temp" />
  </div>
</template>
<script>
import TemplateNew from '@/template/index'
import { requestGet } from '@/api/system/common'

export default {
  name: 'LiveBosColumnItem', // 栏目组件
  components: { TemplateNew },
  props: {
    height: {
      type: Number,
      default: 4
    },
    column: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      temp: {
        column: {
          id: this.column
        }
      },
      style: {}
    }
  },
  watch: {
    column: {
      handler(newName, old) {
        this.initColumnSet(newName)
      },
      immediate: true
    }
  },
  methods: {
    initColumnSet(id) {
      requestGet('rest/api/sys/livebos/v1/setting/template/columns',
        { cid: id }).then(res => {
        const { data } = res
        if (data !== undefined && data !== null) {
          this.temp = data
          this.temp.isLiveBos = true
        }
      }).catch(() => {
        this.temp = null
      })
    }
  }
}
</script>
<style scoped>
.body-item-li {
  width: 100%;
  height: 100%;
  padding: 0;
  box-sizing: border-box;
}

.body-item-li:hover {
  display: flex;
  flex-flow: row nowrap;
}
</style>
